<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="fragments/layout(title='床位管理-编辑',jsPaths='/static/js/baseinfo/bed/add.js')">
<div class="right" th:fragment="right">
    <!--面包屑-->
    <div class="breadcrumb layui-bg-gray">
                <span class="layui-breadcrumb" lay-separator=">">
                    <a th:href="@{/}">首页</a>
                       <a href="/organization">系统管理</a>
                    <a href="/bed">床位管理</a>
                    <a><cite>编辑</cite></a>
                </span>
    </div>

    <!--主体内容区-->
    <div class="form-content layui-container">
        <form class="layui-form" th:action="@{/bed/update}" method="post">
            <input type="hidden" name="id" th:value="${bed.id}">
            <div class="layui-form-item">
                <label class="layui-form-label must">所属楼宇</label>
                <div class="layui-input-block">
                    <select name="buildingId" id="buildingId" lay-filter="buildingId" lay-verify="required">
                        <option value=""></option>
                        <option th:each="b:${buildings}" th:value="${b.id}" th:text="${b.name}" th:selected="${bed.buildingId eq b.id}"></option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">所属楼层</label>
                <div class="layui-input-block">
                    <select id="floorNo" name="floor" lay-filter="floorNo" lay-verify="required">
                        <option value=""></option>
                        <option th:each="r:${bed}" th:value="${r.floor}" th:text="${r.floor}" th:selected="${bed.floor }"></option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">所属房间</label>
                <div class="layui-input-block">
                    <select name="roomId" id="roomId" lay-verify="required">
                        <option value=""></option>
                        <option th:each="r:${rooms}" th:value="${r.id}" th:text="${r.code}" th:selected="${bed.roomId eq r.id}"></option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">床位编号</label>
                <div class="layui-input-block">
                    <input type="text" name="code" th:value="${bed.code}"  maxlength="10"  lay-verify="required" placeholder="请床位编号,如：1" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">床位类型</label>
                <div class="layui-input-block">
                    <select name="type" lay-verify="required"  th:if="${userType==1}">
                        <option value=""></option>
                        <option value="1" th:selected="${bed.type eq 1}">普通床位</option>
                        <option value="2" th:selected="${bed.type eq 2}">护理床位</option>
                    </select>
                    <select name="typeId" lay-verify="required" th:if="${userType==2}">
                        <option value=""></option>
                        <option  th:each="t:${bedTypes}" th:text="${t.name}" th:value="${t.id}" th:selected="${t.name eq bed.typeName}"></option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label must">床位状态</label>
                <div class="layui-input-block">
                    <select name="status" lay-verify="required">
                        <option value=""></option>
                        <option value="1" th:selected="${bed.status eq 1}">空闲</option>
                        <option value="2" th:selected="${bed.status eq 2}">已住</option>
                        <option value="3" th:selected="${bed.status eq 3}">在建</option>
                        <option value="4" th:selected="${bed.status eq 4}">停用</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitBtn">保存</button>
                    <a href="/bed" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>

    </div>
</div>
</html>